package cn.aloxc.tianya.reader;


import cn.aloxc.tools.RSSItem;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
import android.content.Intent;
import android.view.*;

public class Activity_test_xmllist_content extends Activity {
	private String title = null;
	private String description = null;
	private String link = null;
	private String category = null;
	private String pubdate = null;
	private String guid = null;
	private TextView tv_title = null;
	private WebView tv_description = null;
	private TextView tv_link = null;
	private TextView tv_category = null;
	private TextView tv_pubdate = null;
	private TextView tv_guid = null;
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.activity_test_xmllist_content);
		Intent startingIntent = getIntent();
		tv_category = (TextView)findViewById(R.id.test_xmllist_content_show_category);
		tv_description = (WebView)findViewById(R.id.test_xmllist_content_show_description);
		tv_guid = (TextView)findViewById(R.id.test_xmllist_content_show_guid);
		tv_link = (TextView)findViewById(R.id.test_xmllist_content_show_link);
		tv_pubdate = (TextView)findViewById(R.id.test_xmllist_content_show_pubdate);
		tv_title = (TextView)findViewById(R.id.test_xmllist_content_show_title);
		if (startingIntent != null) {
			Bundle bundle = startingIntent
					.getBundleExtra("android.intent.extra.rssItem");
			if (bundle == null) {
				description = "发生错误！";
				tv_category.setVisibility(0);
				tv_guid.setVisibility(0);
				tv_link.setVisibility(0);
				tv_pubdate.setVisibility(0);
				tv_title.setVisibility(0);
			} else {
				title = bundle.getString(RSSItem.TITLE) ;
				pubdate = bundle.getString(RSSItem.PUBDATE) ;
				description = bundle.getString(RSSItem.DESCRIPTION) ;
				guid = bundle.getString(RSSItem.GUID) ;
				link = bundle.getString(RSSItem.LINK) ;
				category = bundle.getString(RSSItem.CATEGORY) ;
				tv_title.setText(title);
				tv_pubdate.setText(pubdate);
				tv_description.loadDataWithBaseURL(null, description, "text/html", "utf-8", null);
				tv_guid.setText(guid);
				tv_link.setText(link);
				tv_category.setText(category);

			}
		} else {
			description = "发生错误！";
			tv_category.setVisibility(0);
			tv_guid.setVisibility(0);
			tv_link.setVisibility(0);
			tv_pubdate.setVisibility(0);
			tv_title.setVisibility(0);
		}

		

		Button backbutton = (Button) findViewById(R.id.test_xmllist_back);

		backbutton.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View v) {
				finish();
			}
		});
	}
}
